<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <div class="div" id="div">
        <!-- <img src="img/0.png" alt=""> -->
    </div>

    <!-- 倒计时 -->
    <script>
        //  var date = new Date();//获取当前时间
        //  var time = date.getTime();//获取当前时间戳
        //  var date2 = new Date('2020/10/1 0:0:0')//获取国庆时间
        //  var time1 = date2.getTime();//获取国庆时间戳
        //  var days=(time1-time);//时间戳差
        //  var day = parseInt(days / 1000 / 60 / 60 / 24);//天
        //  var hours = parseInt((days / 1000 / 60 / 60) % 24);//小时
        //  var m = parseInt((days / 1000 / 60) % 60);//分钟
        //  var s = parseInt((days / 1000) % 60)//秒
        // console.log('距离国庆还有：'+day+'天'+hours+'小时'+m+'分'+s+'秒'); 


        // 国庆倒计时还有多少天？
         function time(){
            var date = new Date();//获取当前时间
            var time = date.getTime();//获取当前时间戳
            var date2 = new Date('2020/10/1 0:0:0')//获取国庆时间
            var time1 = date2.getTime();//获取国庆时间戳
            var days=(time1-time);//时间戳差
            var day = parseInt(days / 1000 / 60 / 60 / 24);//天
                day= day< 10 ? '0'+day:day;

            var hours = parseInt((days / 1000 / 60 / 60) % 24);//小时
                hours =hours< 10 ? '0'+hours:hours;

            var m = parseInt((days / 1000 / 60) % 60);//分钟
                m =m< 10 ? '0'+m:m;

            var s = parseInt((days / 1000) % 60)//秒
                s =s< 10 ? '0'+s:s;

            return ''+day+hours+m+s
         }  

        var timer=setInterval(function(){
            var gz=time();
            div.innerHTML='';
            for(var i=0;i<gz.length;i++){
                console.log(gz[i]); 
                div.innerHTML+='<img src="img/'+gz[i]+'.png" alt="">'+(i == (gz.length-3)||i ==(gz.length-5)||i ==(gz.length-7)?':':'');
            }
        },1000)

        


         
    </script>

</body>
</html>